home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1997
/
MacHack 1997.toast
/
Hacks
/
Hacks ’96
/
FinderFlocks
/
Shell
/
main.cp
< prev
next >
Wrap
Text File
|
1996-06-23
|
2KB
|
94 lines
#include "Shell.h"
#include "CFlock.h"
#include "FlockDrawing.h"
#include "FinderFun.h"
Boolean gDoneFlag = false;
RgnHandle gWorldRgn = NewRgn();
// finder stuff
long gNumItems = 0;
Handle gIcons[kMaxBoids];
Handle gMasks[kMaxBoids];
Point gPositions[kMaxBoids];
Rect gWindowRect;
long gWindowView;
// The global flock
CFlock *gTheFlock;
void InitParamBlock(void);
void main (void)
{
EventRecord theEvent;
CursHandle Curs;
short err;
unsigned long seed;
long dum;
FlushEvents (everyEvent - diskMask, 0 );
MaxApplZone();
InitGraf (&qd.thePort);
InitFonts ();
InitWindows ();
InitMenus ();
TEInit ();
InitDialogs (nil);
InitCursor ();
/* Make a buncha Master pointers */
MoreMasters();
MoreMasters();
MoreMasters();
MoreMasters();
MoreMasters();
MoreMasters();
MoreMasters();
MoreMasters(); // Enough? :-)
Curs = GetCursor(watchCursor);
SetCursor(*Curs);
// Get finder junk
err = GatherFinderInfo(kMaxBoids);
if(err)
ExitToShell();
// Set up drawing to use Draw Sprocket. Also sets up the
// world region.
err = SetUpDrawing(gWorldRgn);
if(err)
ExitToShell();
/* Reset random number generator */
GetDateTime(&seed);
qd.randSeed = seed;
// OK, make the Flock
gTheFlock = (CFlock *)(new CFlock)->InitFlock(gWorldRgn);
SetCursor(&qd.arrow);
if(gTheFlock != nil)
{
while(!gDoneFlag)
{
WaitNextEvent(everyEvent, &theEvent, 0, nil);
DoEvent(&theEvent);
}
// close down flock
gTheFlock->KillFlock(gWorldRgn);
delete gTheFlock;
gTheFlock = nil;
}
else SysBeep(10);
// Close down Draw Sprocket
err = CloseDownDrawing();
}